﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;

namespace System
{
	internal static class ParentNodeManager
	{
		private static Dictionary<Type, ParentNodeClass> cache;

		static ParentNodeManager()
		{
			cache = new Dictionary<Type, ParentNodeClass>();
		}

		public static PropertyInfo GetParentNode(Type type)
		{
			if (cache.ContainsKey(type))
			{
				return cache[type].ParentProperty;
			}
			else
			{
				ParentNodeClass parentNode = new ParentNodeClass(type);

				cache[type] = parentNode;

				return parentNode.ParentProperty;
			}
		}
	}
}
